//
//  InfoServicetableViewCell.m
//  BigToBig
//
//  Created by 毛丽媛 on 16/7/28.
//  Copyright © 2016年 cn.cloudtp. All rights reserved.
//

#import "InfoServicetableViewCell.h"

#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height

@implementation InfoServicetableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
}


- (void)createSubViews{
    //  头像
    self.headImageView = [[UIImageView alloc]init];
    self.headImageView.image = [UIImage imageNamed:@"touxiang"];
    [self.contentView addSubview:self.headImageView];

    
    // 标题
    self.titleLabel = [[UILabel alloc]init];
    self.titleLabel.text = @"创业生态园";
    [self.contentView addSubview:self.titleLabel];
    self.titleLabel.textAlignment = NSTextAlignmentLeft;
    
    
    // 描述
    self.describeLabel = [[UILabel alloc]init];
    self.describeLabel.font = [UIFont systemFontOfSize:13];
    self.describeLabel.textColor = [UIColor lightGrayColor];
    //self.describeLabel.backgroundColor = [UIColor yellowColor];
    [self.contentView addSubview:self.describeLabel];
    
    
    // 位置图标
    self.cityPic = [[UIImageView alloc]init];
    self.cityPic.image = [UIImage imageNamed:@"weizhi"];
    [self.contentView addSubview:self.cityPic];
    
    // 城市
    self.cityLabel = [[UILabel alloc]init];
    self.cityLabel.font = [UIFont systemFontOfSize:12];
    self.cityLabel.textColor = [UIColor lightGrayColor];
    self.cityLabel.textAlignment = NSTextAlignmentLeft;
    //self.cityLabel.backgroundColor = [UIColor magentaColor];
    [self.contentView addSubview:self.cityLabel];
    
    // 电话图标
    self.phonePic = [[UIImageView alloc]init];
    self.phonePic.image = [UIImage imageNamed:@"phone"];
    [self.contentView addSubview:self.phonePic];
    
    
    // 电话
    self.phoneLabel = [[UILabel alloc]init];
    self.phoneLabel.font = [UIFont systemFontOfSize:12];
    self.phoneLabel.textColor = [UIColor lightGrayColor];
    self.phoneLabel.textAlignment = NSTextAlignmentLeft;
    //self.phoneLabel.backgroundColor = [UIColor yellowColor];
    [self.contentView addSubview:self.phoneLabel];
    
    // 底层分割线
    self.bottomLabel = [[UILabel alloc]init];
    self.bottomLabel.backgroundColor = COLOR_RGBA(247, 247, 247, 1);
    [self.contentView addSubview:self.bottomLabel];
}

- (void)layoutSubviews{
    [super layoutSubviews];
    self.headImageView.frame = CGRectMake(15, 15, self.contentView.frame.size.height - 30 , self.contentView.frame.size.height - 30);
    self.titleLabel.frame = CGRectMake(self.headImageView.maxX + 10, self.headImageView.y, WIDTH - self.headImageView.maxX - 20, 25);
    self.describeLabel.frame = CGRectMake(self.titleLabel.x, self.titleLabel.maxY + 5, kScreenWidth - self.titleLabel.x - 10, 25);
    self.cityPic.frame = CGRectMake(self.describeLabel.x, self.describeLabel.maxY + 5, 17, 17);
    self.cityLabel.frame = CGRectMake(self.cityPic.maxX + 2, self.describeLabel.maxY + 5, 60 , 20);
    self.phonePic.frame = CGRectMake(kScreenWidth - 120, self.cityPic.y, 17, 17);
    self.phoneLabel.frame = CGRectMake(self.phonePic.maxX + 2, self.cityLabel.y,80, 20);
    self.bottomLabel.frame = CGRectMake(0, HEIGHT - 1, kScreenWidth, 1);
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
